<?php
/**
 * Created by PhpStorm.
 * User: wanglin
 * Date: 2018/9/13
 * Time: 14:49
 */

namespace App\Services\ThirdAPI;
use Illuminate\Support\Facades\Log;

class LEBOAPIService
{

    protected $apiName = 'lebo';


    /**
     * 获取视讯注单
     */
    public function getLEBOOrderLists($startTime)
    {
        $url = config('app.rpcserver') . "/api/getOrders";
        $data=[
            'api_name' => $this->apiName,
            'next_time' => $startTime
        ];
        Log::info("LEBO视讯注单抓取接口请求url:====" . $url . "请求拉取注单开始时间:".$startTime);
        $result = GameApiService::request($url, 'get', $data);
        Log::info("LEBO视讯注单抓取接口请求url:====" . $url . "请求参数:======" . json_encode($data, JSON_UNESCAPED_UNICODE) . "请求时间:====" . date("Y-m-d H:i:s") . "总共有" . count($result['data']) . "条数据");
        Log::info("lebo注单下次拉取时间为:". $result['next_time']??"");
        amount_format_array($result['data'],['bet_money','winloss_money','prize_money','valid_money','contribute_money','bonus_money'],true);
        return $result;
    }

    /**
     * 获取下注记录
     * @param $startTime
     * @return object
     */
    public function getBetList($startTime)
    {
        $url = config('app.rpcserver') . "/api/getBetList";
        $data=[
            'api_name' => $this->apiName,
            'next_time' => $startTime
        ];
        Log::info("LEBO视讯注单抓取注单下注记录接口请求url:====" . $url . "请求拉取注单下注记录开始时间:".$startTime);
        $result = GameApiService::request($url, 'get', $data);
        Log::info("LEBO视讯注单下注记录抓取接口请求url:====" . $url . "请求参数:======" . json_encode($data, JSON_UNESCAPED_UNICODE) . "请求时间:====" . date("Y-m-d H:i:s") . "总共有" . count($result['data']) . "条数据");
        Log::info("lebo下注记录下次拉取时间为:". $result['next_time']??"");
        amount_format_array($result['data'],['bet_money','valid_money','win_loss'],true);
        return $result;
    }



}